﻿@model Peninsula.Web.Areas.Backstage.Models.RepairOrder.RepairOrderCreateOrEditModel

@section Scripts{
         <script type="text/javascript">
                        @*$(function(){

                            var s=$('#MaintenanceStaffId option:selected').val();
                            @ViewData["a"]=s;
                        });*@
            function RepairOrderSendEmail() {
                 $.ajax({
                     type: "POST",
                     async:false, //同步执行 $("#Total").serialize(),
                     data:{'id':'@Model.Id',
                         'MaintenanceStaffId': $('#MaintenanceStaffId option:selected').val(),
                         "__RequestVerificationToken": $("input[name='__RequestVerificationToken']").val()
                     },
                     url: "@Url.Action("RepairOrderSendEmail")",
                     dataType: "json", //返回数据形式为json
                     success: function (result) {
                         if (result.Success==true) {
                             alert("派遣成功");
                             location.href = "http://localhost:61748/Backstage/StoreManger/OrderTrackingForStoreManger";
                         } else {
                             alert("派遣失败！")
                         }
                         

                     },
                     error: function (errorMsg) {
                         alert("数据出错！");
                     }

                 })
             }
        </script>
   }

<!-- BEGIN FORM PORTLET -->
<div class="portlet">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-reorder"></i>派遣维修人员
        </div>
    </div>
    <div class="portlet-body form">

        @using (Html.BeginForm("RepairOrderSend", "StoreManger", FormMethod.Post,
                            new { @class = "form-horizontal js-form js-ajax-form", enctype = "multipart/form-data", id = "fileupload" }))
        {
            @Html.AntiForgeryToken()
            @Html.HiddenFor(m => m.Id)
            @*@Html.Hidden("isEdit", isEdit)*@
            <div class="form-body">
      
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        <span style="color:red">*</span>@Html.DisplayNameFor(m => m.MaintenanceStaffId)
                    </label>
                    <div class="col-md-5">
                        @Html.DropDownListFor(m => m.MaintenanceStaffId, Model.MaintenanceStaffs, new { @class = "form-control select2" })
                        @Html.ValidationMessageFor(m => m.MaintenanceStaffId)
                    </div>
                </div>
            </div>
            <div class="form-actions fluid">
                <div class="col-md-offset-3 col-md-9">
                    <button type="submit" class="btn btn-success">提交并发送短信</button>
                    <input type="button" class="btn btn-success" onclick="RepairOrderSendEmail()" value="提交并发送邮件" />
                   
                    @*<a data-confirm-text="确定要删除吗？" data-confirm-button="确定" data-cancel-button="取消"
                       data-confirmed-url="@Url.Action("RepairOrderSendEmail", "StoreManger", new { id = Model.Id ,MaintenanceStaffId=ViewData["a"]})"
                       class="btn btn-success  js-table-ajax-confirm-button">提交并发送邮件
                    </a>*@
                    <a href="@HttpContext.Current.Request.UrlReferrer" class="btn btn-default">取消</a>
                </div>
                
            </div>
        }
        
    </div>
</div>
